<!-- 箱子管理 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label">箱子管理</p>
    <div class="btm mt10 pt10">
      <dxtable
        :dataJson="dataJson"
        :portUrl="portUrl"
        :qx="qx"
        ref="databale"
        :formJson="formJson"
        :czFun="czFun"
        czWidth="240"
        bjtext="修改"
        :headBtn="headBtnw"
        :showdr="true"
        drerrtext="箱子导入模板内容不能为空，请修改后重试！"
        :extra="extra"
      ></dxtable>
    </div>
  </div>
</template>
 <script lang='ts' setup>
import dxtable from "../../../components/util/dxtable.vue";
import { dxget, dxpost, qurl, readExcel, hf } from "../../../util/index";
import { h, ref, reactive } from "vue";
import { NButton } from "naive-ui";
const cz = qurl();
const dftte = ref();
const databale = ref();

const emit = defineEmits(["callBack"]);
// 弹窗公用该列表
let dataJson = reactive([
  {
    title: "编号",
    key: "serialNumber|numericalOrder|describe", //多个关键字搜索
    search: true, // 是否在搜索栏展示
    placeholder: "输入关键字查询",
    render(row) {
      return row.serialNumber;
    },
  },
  {
    title: "序号",
    key: "numericalOrder",
  },
  {
    title: "描述",
    key: "describe",
  },
  {
    title: "签收状态",
    key: "StateOfSign",
    render(row) {
      return row.signature ? "是" : "否";
    },
  },
  {
    title: "备注",
    key: "remark",
  },
  {
    title: "是否导入物料",
    key: "ImportMaterialsONot",
    render(row) {
      return row.ImportMaterialsONot == 1 ? "否" : "是";
    },
  },

  {
    title: "创建时间",
    key: "addTime",
    width: "200",
    type: "daterange",
  },
]);
let portUrl = "kx/kxboxMsg?parentLevel=" + cz.id;
const extra = ref({
  parentLevel: cz.id,
});
const qx = {
  DeletePermissionID: "kxboxManagementdel", //删除
  EditPermissionIdentifier: "kxboxManagementbj", // 编辑
  NewPermissionIdentifier: "kxboxManagementxz", // 新建
  ViewPermissionID: "kxboxManagementck", // 查看
};

let formJson = reactive([
  {
    title: "编号",
    key: "serialNumber",
    type: "input",
  },
  {
    title: "序号",
    key: "numericalOrder",
    type: "input",
  },
  {
    title: "描述",
    key: "describe",
    type: "input",
  },
]);
const headBtnw = ref([
  {
    name: "下载箱子导入模板",
    jy: true,
    type: "default",
    clickFun: () => {
      downloadXLSX();
    },
  },
]);

const czFun = {
  fun: (row) => {
    return [
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {
            hf("kxmaterialManagement", { id: row.id });
          },
        },
        "物料导入"
      ),
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {
            if (!row.OutOfTheReport) {
              window.$message.error("请先验收再操作！");
              return;
            }
            open(row.OutOfTheReport);
          },
        },
        "查看签收报告"
      ),
    ];
  },
};
const downloadXLSX = () => {
  window.location.href =
    "https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/adminstatic/%E7%AE%B1%E5%AD%90%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx";
};
</script>
 <style scoped>
</style>


